#!/usr/bin/env python
# _*_ coding: utf-8 _*_

"""Print ARGV to stdout.

This program serves for two purposes:
- To act as a template to start new Python programs.
- To print the arguments to standard output.

Usage:
  -h, --help		This help message.
  -v, --version		Print version."""

import sys
import getopt

__author__ = "Rudá Moura"
__copyright__ = "Copyright (c) 2010 Rudá Moura"
__license__ = "BSD"
__version__ = "2010"

PROGRAM = sys.argv[0]

def usage():
    print __doc__

def version():
    print PROGRAM, "version", __version__
    print __copyright__

def main(argv=None):
    if argv is None:
        argv = sys.argv
    try:
        opts, args = getopt.getopt(argv[1:], "hv", ["help", "version"])
    except getopt.error, msg:
        print >>sys.stderr, PROGRAM, ":", msg
        return 2
    for opt, arg in opts:
        if opt in ("-h", "--help"):
            usage()
            return 0
        if opt in ("-v", "--version"):
            version()
            return 0
    for arg in args:
        print arg
    return 0

if __name__ == "__main__":
    sys.exit(main())
